package com.eastmoney.emis.edda.task.report;

import com.eastmoney.emis.edda.infrastructure.report.service.ReportService;
import com.eastmoney.emis.edda.task.handler.TaskHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @description: Description
 * @projectName: EDDA-HSBC
 * @package: com.eastmoney.emis.edda.task
 * @author: 汪程程
 * @date: 2022/10/10 2:22 PM
 * @version: 1.0
 */
@Component("ReportTaskHandler")
public class ReportTaskHandler implements TaskHandler<ReportTask> {

    @Autowired
    private ReportService reportService;

    public ReportTaskHandler() {
    }


    @Override
    public void handle(ReportTask task) {
        switch (task.getReportType()) {
            case DDAReport:
                reportService.processEddaReport(task.getReportDate());
                break;
            case DDIReport:
                reportService.processEddiReport(task.getReportDate());
                break;
            default:
                throw new IllegalArgumentException("Unknown report type: " + task.getReportType());
        }
    }
}
